package com.example.juc.big_talk_concurrent.chapter7.article3;

import java.util.concurrent.*;

public class Test {
    static class Task implements Callable<String> {
        @Override
        public String call() throws Exception {
            return "123";
        }
    }

    public static void main(String[] args) {
        ThreadPoolExecutor threadPool = new ThreadPoolExecutor(2, 4, 10, TimeUnit.SECONDS, new ArrayBlockingQueue<>(10));
        Future<String> future = threadPool.submit(new Task());

        try {
            System.out.println(future.get());
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            threadPool.shutdown();
        }

    }
}
